package com.k2data.k2app.rest;

import com.k2data.k2app.domain.deviceRest.SysLog;
import com.k2data.k2app.rest.domain.RectList;
import com.k2data.k2app.rest.domain.RectObject;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

/**
 * Created by clb on 17-6-15.
 */
@Component
@FeignClient(value = "K2ALPHA-SYS-V1", fallback = SystemClientFallback.class)
public interface SystemClient {

	@RequestMapping(method = RequestMethod.GET, value = "/users/{id}")
	RectObject getUserById (@PathVariable("id") Long id);

	@RequestMapping(method = RequestMethod.GET, value = "/users")
	RectList getUserByLoginName (@RequestParam("loginName") String loginName);

	@RequestMapping(method = RequestMethod.GET, value = "/mail/useful")
	RectObject getUsefulMailSetting ();

	@RequestMapping(method = RequestMethod.GET, value = "/sms/useful")
	RectObject getUsefulSmsSetting ();

	@RequestMapping(method = RequestMethod.POST, value = "/logs")
	RectObject insertLog (@RequestBody SysLog map);

	@RequestMapping(method = RequestMethod.GET, value = "/users/{id}/roles")
	RectList getRolesByUser(@PathVariable("id") Long id);
}
